<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Benchmark</title>
    <script type="text/javascript" src="benchmarker.js"></script>
    <script type="text/javascript">
/* <![CDATA[ */
new Benchmarker({},
{
  // custom Benchmark options
  atInit: function() {
    this.TEST = (1).range(parseInt(this.title.replace(/^.*= /, '')));
  },

  // custom Benchmarker options
  summary: 'Enumerable.include() vs raw OR logic',
  setup: function() {
    var genOR = function(limit, value) {
      eval(
        'var func = function(){return '
        + (1).range(limit).join(' === ' + value + ' || ') + ' === ' + value
        + '}'
      );
      return func;
    };
/*    $w('1 2 5 10 100').each(function(num) { */
    $w('1 10 100').each(function(num) {
      eval('var iesux = function(){return this.TEST.include(' + num + ')}');
      methodSets.push({
        name: 'values.length = ' + num,
        methods: {
          include_none: function(){return this.TEST.include(0)},
          include_start: function(){return this.TEST.include(1)},
          include_end: iesux,
          or_none: genOR(num, 0),
          or_start: genOR(num, 1),
          or_end: genOR(num, num)
        }
      });
/*
      $H(methodSets[methodSets.length-1].methods).each(function(k){
        console.debug(k.key, k.value.toString());
      });
*/
    });
  }
});
/* ]]> */
    </script>
  </head>
  <body>
  </body>
</html>
